/*******************************************************************************
 * Copyright (c) 2010 Gary Yund {OTHER COPYRIGHT OWNERS}.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Gary Yund - initial API and implementation and/or initial documentation
 *******************************************************************************/

#import "BB_ViewManagerProtocolTestCase.h"

#import "BB_ViewManagerProtocolUserStub.h"
#import "BB_ViewManagerStub.h"

@implementation BB_ViewManagerProtocolTestCase

@synthesize viewManager;
@synthesize protocolUser;

- (void) setUp
{
    viewManager  = [[ BB_ViewManagerStub alloc] init];
    protocolUser = [[ BB_ViewManagerProtocolUserStub alloc] init];
}

- (void) tearDown
{
    [ self.viewManager release];
    [ self.protocolUser release];
}


- (void) testProtocolManager
{
    // Test the displayView from the manager's perspective
    // (doesn't use the protocol)
    [self.viewManager displayView:protocolUser];
    
    STAssertEquals( self.protocolUser.bbViewManager, viewManager,
                   @"ViewManager failed to set bbViewManager");
}

- (void) testProtocolUser
{
    [self.viewManager displayView:protocolUser];
    
    // Test the displayView function from the user's perspective 
    // (using the protocol)
    [[self.protocolUser bbViewManager] displayView:protocolUser];
    STAssertEquals( self.protocolUser.bbViewManager, viewManager,
                   @"Protocol User failed to call viewManager's displayView");
    
}



@end
